import { createRouter,createWebHistory } from 'vue-router'

const routes = [
    {
        path: '/',
        name: 'index',
        component: () => import('../view/Publish.vue')
    },
    {
        path: '/publish',
        name: 'Publish',
        component: () => import('../view/Publish.vue')
    },
    {
        path: '/systemSetting',
        name: 'SystemSetting',
        component: () => import('../view/SystemSetting.vue')
    }
]

const router = new createRouter({
    mode: 'history',
    history: createWebHistory("/"),
    routes
})

router.beforeEach((to, from, next) => {
  if(to.meta.title)  document.title = to.meta.title
  // if(to.path === '/login') return next()
  // if(!sessionStorage.getItem('token')) return next('/login')
  next()
})

export default router
